import React, { Component } from 'react'
import Login from './Login'

export default class Common extends Component {
  state = {
    username: '',
    password: '',
    repassword: '',
  }
  handle = (name) => (e) => {
    this.setState({
      [name]: e.target.value.trim(),
    })
  }
  render() {
    return (
      <this.props.ele
        //批量传递props.这一行代码就相当于是20~22行
        {...this.state}
        // username={this.state.username}
        // password={this.state.password}
        // repassword={this.state.repassword}
        handle={this.handle}
      ></this.props.ele>
    )
  }
}
